/* GUI CONVERTED from rspoamt.p (converter v1.76) Wed May 22 11:23:04 2002 */
/* rspoamt.p - Release Management - Scheduled PO Effective Alloc Perc Maint   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.6.1.3 $                                                       */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3    LAST MODIFIED: 10/12/92           BY: WUG *G462*          */
/* REVISION: 7.3    LAST MODIFIED: 04/25/94           BY: WUG *GJ59*          */
/* REVISION: 8.5    LAST MODIFIED: 10/18/94           BY: mwd *J034*          */
/* REVISION: 7.3    LAST MODIFIED: 04/09/95           BY: vrn *G0MD*          */
/* REVISION: 8.5    LAST MODIFIED: 11/06/96           BY: *G2HS* Suresh Nayak */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.6.1.3 $   BY: Jean Miller        DATE: 05/20/02  ECO: *P05V*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

{mfdtitle.i "2+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rspoamt_p_1 "Effective"
/* MaxLen: Comment: */

&SCOPED-DEFINE rspoamt_p_2 "Ship-To Site"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

define variable site    as character label "Ship-To Site".
define variable part    like pt_part.
define variable effdate as date label "Effective".
define variable begstr  as character.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
space(1)
   site
   part
   effdate
 SKIP(.4)  /*GUI*/
with frame a width 80 attr-space side-labels NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

mainloop:
repeat:
/*GUI*/ if global-beam-me-up then undo, leave.


   set
      site part effdate
   with frame a
   editing:

      if frame-field = "site" then do:
         {mfnp05.i qad_wkfl qad_index1
            "qad_key1 = ""poa_det""" qad_key2 "input site"}

         if recno <> ? then do:
            display
               qad_charfld[3] @ site
               qad_charfld[2] format "x(18)" @ part
               qad_datefld[1] @ effdate
            with frame a.
         end.
      end.

      else
      if frame-field = "part" then do:
         {mfnp05.i qad_wkfl qad_index1
            "qad_key1 = ""poa_det""
              and qad_key2 begins string(input site,""x(8)"")"
            qad_key2
            "string(input site,""x(8)"") + input part"}

         if recno <> ? then do:
            display
               qad_charfld[3] @ site
               qad_charfld[2] format "x(18)" @ part
               qad_datefld[1] @ effdate
            with frame a.
         end.
      end.

      else
      if frame-field = "effdate" then do:
         {mfnp05.i qad_wkfl qad_index1
            "qad_key1 = ""poa_det""
              and qad_key2 begins string(input site,""x(8)"") +
             string(input part,""x(18)"")"
            qad_key2
            "string(input site,""x(8)"") + string(input part,""x(18)"")
              " }

         if recno <> ? then do:
            display
               qad_charfld[3] @ site
               qad_charfld[2] format "x(18)" @ part
               qad_datefld[1] @ effdate
            with frame a.
         end.
      end.

      else do:
         status input.
         readkey.
         apply lastkey.
      end.

   end.

   if effdate = ? then do:
      {pxmsg.i &MSGNUM=27 &ERRORLEVEL=3}
      next-prompt effdate with frame a.
      undo, retry.
   end.

   find si_mstr where si_site = site no-lock no-error.
   if not available si_mstr then do:
      {pxmsg.i &MSGNUM=708 &ERRORLEVEL=3} /* "Site does not exist" */
      undo, retry.
   end.

   if si_db <> global_db then do:
      /* You must be in database */
      {pxmsg.i &MSGNUM=8148 &ERRORLEVEL=3 &MSGARG1=si_db}
      undo mainloop, retry.
   end.

   {gprun.i ""gpsiver.p""
      "(input site, input recid(si_mstr), output return_int)"}
/*GUI*/ if global-beam-me-up then undo, leave.


   if return_int = 0 then do:
      {pxmsg.i &MSGNUM=725 &ERRORLEVEL=3}
      /*USER DOES NOT HAVE ACCESS TO THIS SITE */
      next-prompt site with frame a.
      undo mainloop, retry.  /* J034* ADDED MAINLOOP */
   end.

   find pt_mstr where pt_part = part no-lock no-error.
   if not available pt_mstr then do:
      {pxmsg.i &MSGNUM=16 &ERRORLEVEL=3}
      undo, retry.
   end.

   {gprun.i ""rspoamta.p"" "(input part, input site, input effdate )"}
/*GUI*/ if global-beam-me-up then undo, leave.


end.
/*GUI*/ if global-beam-me-up then undo, leave.

